package org.study.shardingjdbcdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.study.shardingjdbcdemo.entity.Order;
import org.study.shardingjdbcdemo.entity.OrderVo;

import java.util.List;

/**
 * @author
 * @date 2022年10月23日 19:41
 * @description
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {


    @Select({"SELECT a.order_no, sum(b.count*b.price) as amount FROM t_order a " ,
            "left join t_order_item b on a.order_no=b.order_no  group by a.order_no"})
    List<OrderVo> getOrderAmount();
}
